
{extend name='public/window' /}

{block name="content"}
<style>
    .layui-upload-drag {
        position: relative;
        padding: 10px;
        border: 1px dashed #e2e2e2;
        background-color: #fff;
        text-align: center;
        cursor: pointer;
        color: #999;
        border-radius: 50%;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
                {if isset($info.id)}
                <input type="hidden" name="id" value="{$info.id}">
                {/if}
                <input type="hidden" name="__token__" id="token" value="{:token()}"/>
                <div class="layui-form-item">
                    <label class="layui-form-label">罚款项 *</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" autocomplete="off"
                               placeholder="罚款项" class="layui-input" id="merchant_sn_edit">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">请选择关联任务 </label>
                    <div class="layui-input-block" >
                        <select name="task_id"   lay-search="">
                            <option value="">请选择</option>
                            {foreach $task as $v}
                            <option value="{$v['id']}">{$v['name']}</option>
                            {/foreach}

                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">选择开具人员 </label>
                    <div class="layui-input-block" >
                        <select name="identity"   lay-search="">
                            <option value="">请选择</option>
                            <option value="1">物业</option>
                            <option value="2">营运</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item merch">
                    <label class="layui-form-label">内容 *</label>
                    <div class="layui-input-block">
                        {if !empty($info['content'])}
                        <textarea id="content" lay-verify="content"  name="content">{$info['content']}</textarea>
                        {else/}
                        <textarea id="content" lay-verify="content"  name="content"></textarea>
                        {/if}
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button class="layui-btn" lay-submit="" lay-filter="add">{:__('Submit')}</button>
                            <button type="reset" class="layui-btn layui-btn-primary">{:__('Reset')}</button>
                        </div>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>


<script>
    layui.use(['element', 'form', 'jquery','lucky','upload','laydate','xmSelect', 'layedit'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;
        var layedit = layui.layedit;
        var $ = layui.jquery;
        var lucky=layui.lucky;
        layedit.set({	//设置图片接口
            uploadImage: {
                url: "{:url('Common/UpEditorPic')}", //接口url
                type: 'post'
            }
        });
        //创建一个编辑器，lay_edit为textarea标签的id值
        var index = layedit.build('content', {
            width: 200,
            height: 350    //设置编辑器的高度
        });
        //赋值
        form.verify({
            content: function(value) {
                return layedit.sync(index);
            }
        });
        //表单赋值
        var info = {:json_encode($info)};
        form.val("form",info);
        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('add')}",data.field,true);
            return false;
        });
    })
</script>

{/block}

